<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>滚动</title>
		<style>
			body{
				height:20000px;
			}
			#d{
				position: absolute;
				top: 500px;
			}
		</style>
		<script type="text/javascript" src="js/jquery-3.3.1.min.js" ></script>
		<script>
			$(function(){
				$(window).on("mousewheel",function(){
					if($(window).scrollTop()>=500){
						$("#d").css({"position":"fixed","top":"0px"});
					}else{
						$("#d").css({"position":"absolute","top":"500px"});
					}
				});
			});
		</script>
	</head>
	<body>
		<div id="d">
			<input type="text" size=35 /><input type="button" size=35 value="搜索" />
		</div>
	</body>
</html>
